/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package control;

import comm.Messenger;

/**
 *
 * @author dheath
 */
public class Speed implements TankAction 
{
    private double value;
    private double error;
    
    public Speed(double value, double error)
    {
        this.value = value;
        this.error = error;
    }
    
    public Speed(double value)
    {
        this.value = value;
        this.error = 0.0;
    }
    public void performAction(Messenger msgr, int botId)
    {
        String resp = msgr.sendCommand("speed " + botId + " " + value);
        while(resp == null)
        {
           resp = msgr.sendCommand("speed " + botId + " " + value);
        }
    }
    
    public double getError()
    {
        return error;
    }
    
    public String toString()
    {
        return "Speed: "+value;
    }
}
